import { createRouter, createWebHistory } from 'vue-router'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/login',
      name: 'Login',
      component: () => import('@/views/user/Login.vue')
    },
    {
      path: '/',
      name: 'GoodsIndex',
      component: () => import('@/views/goods/GoodsIndex.vue')
    },
    //购物车
    {
      path: '/cart',
      name: 'Cart',
      component: () => import('@/views/goods/CartView.vue')
    },
    // 新增商品详情路由
    {
      path: '/detail/:id',
      name: 'GoodsDetail',
      component: () => import('@/views/goods/GoodsDetail.vue'),
      props: true
    },
    //订单页
    {
        path: '/order',
        name: 'GoodsOrder',
        component: () => import('@/views/goods/GoodsOrder.vue'),
        props: true
      }
  ]
})

export default router